package com.jxlg.dao;

import java.util.List;

import org.hibernate.LockMode;
import org.hibernate.Query;
import org.hibernate.Transaction;
import org.hibernate.criterion.Example;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.jxlg.bean.WCarinfo;
import com.jxlg.util.HibernateSessionFactory;

/**
 * A data access object (DAO) providing persistence and search support for
 * WCarinfo entities. Transaction control of the save(), update() and delete()
 * operations can directly support Spring container-managed transactions or they
 * can be augmented to handle user-managed Spring transactions. Each of these
 * methods provides additional information for how to configure it for the
 * desired type of transaction control.
 * 
 * @see com.jxlg.bean.WCarinfo
 * @author MyEclipse Persistence Tools
 */
public class WCarinfoDAO extends BaseHibernateDAO
{
	private static final Logger log = LoggerFactory
			.getLogger(WCarinfoDAO.class);
	// property constants
	public static final String WSBH = "wsbh";
	public static final String UNITSID = "unitsid";
	public static final String ZKLX = "zklx";
	public static final String ZKPZZL = "zkpzzl";
	public static final String ZKDW = "zkdw";
	public static final String HPZL = "hpzl";
	public static final String CPHM = "cphm";
	public static final String CLLX = "cllx";
	public static final String ZKYX = "zkyx";
	public static final String FDJHM = "fdjhm";
	public static final String CJH = "cjh";
	public static final String DSRXM = "dsrxm";
	public static final String DSRSFZ = "dsrsfz";
	public static final String CZXM = "czxm";
	public static final String CZSFZ = "czsfz";
	public static final String CLJG = "cljg";
	public static final String CLYY = "clyy";
	public static final String CZYBH = "czybh";
	public static final String JJDW = "jjdw";
	public static final String YSR = "ysr";
	public static final String DWJB = "dwjb";
	public static final String FXPZH = "fxpzh";
	public static final String QTDW = "qtdw";
	public static final String ZKPZH = "zkpzh";
	public static final String SFYP = "sfyp";
	public static final String NEWTZID = "newtzid";
	public static final String OLDTZID = "oldtzid";
	public static final String SFYYS = "sfyys";
	public static final String SFYGC = "sfygc";
	public static final String GCHP = "gchp";
	public static final String SFYHW = "sfyhw";
	public static final String HWMC = "hwmc";
	public static final String IFYJ = "ifyj";
	public static final String SM = "sm";
	public static final String JDCZT = "jdczt";
	public static final String SDDW = "sddw";
	public static final String SDYY = "sdyy";
	public static final String SDBJ = "sdbj";
	public static final String BFBZ = "bfbz";
	public static final String SFBDQ = "sfbdq";
	public static final String ZJFS = "zjfs";
	public static final String ZJGLS = "zjgls";
	public static final String SFYFDJHCPH = "sfyfdjhcph";
	public static final String CCLB = "cclb";
	public static final String CX = "cx";
	public static final String PGFL = "pgfl";
	public static final String GGNR = "ggnr";
	public static final String ZCDQCODE = "zcdqcode";
	public static final String PLZC = "plzc";
	public static final String BTYZCYY = "btyzcyy";
	public static final String GGPC = "ggpc";
	public static final String SFQZBF = "sfqzbf";
	public static final String SFCX = "sfcx";
	public static final String ZRCC = "zrcc";
	public static final String ZRCCMC = "zrccmc";
	public static final String ZCCC = "zccc";
	public static final String ZCCCMC = "zcccmc";
	public static final String TFWZ = "tfwz";
	public static final String CLFS = "clfs";
	public static final String CLZT = "clzt";
	public static final String RCFS = "rcfs";
	public static final String ZRCZY = "zrczy";
	public static final String ZRCZYXM = "zrczyxm";
	public static final String ZCCZY = "zcczy";
	public static final String ZCCZYXM = "zcczyxm";
	public static final String CZYXM = "czyxm";
	public static final String TFCC = "tfcc";
	public static final String ZDTS = "zdts";
	public static final String CLLB = "cllb";
	public static final String GGJL = "ggjl";
	public static final String CLQX = "clqx";
	public static final String SFWS = "sfws";
	public static final String SFGG = "sfgg";
	public static final String WFDM = "wfdm";
	public static final String WFNR = "wfnr";
	public static final String LRZT = "lrzt";
	public static final String JDSBH = "jdsbh";

	public void save(WCarinfo transientInstance)
	{
		log.debug("saving WCarinfo instance");
		try
		{
			getSession().save(transientInstance);
			log.debug("save successful");
		} catch (RuntimeException re)
		{
			log.error("save failed", re);
			throw re;
		}
	}

	public void delete(WCarinfo persistentInstance)
	{
		log.debug("deleting WCarinfo instance");
		try
		{
			getSession().delete(persistentInstance);
			log.debug("delete successful");
		} catch (RuntimeException re)
		{
			log.error("delete failed", re);
			throw re;
		}
	}

	public WCarinfo findById(java.lang.Integer id)
	{
		log.debug("getting WCarinfo instance with id: " + id);
		try
		{
			WCarinfo instance = (WCarinfo) getSession().get(
					"com.jxlg.bean.WCarinfo", id);
			return instance;
		} catch (RuntimeException re)
		{
			log.error("get failed", re);
			throw re;
		}
	}

	public List<?> findByExample(WCarinfo instance)
	{
		log.debug("finding WCarinfo instance by example");
		try
		{
			List<?> results = getSession()
					.createCriteria("com.jxlg.bean.WCarinfo")
					.add(Example.create(instance)).list();
			log.debug("find by example successful, result size: "
					+ results.size());
			return results;
		} catch (RuntimeException re)
		{
			log.error("find by example failed", re);
			throw re;
		}
	}

	public List<?> findByProperty(String propertyName, Object value)
	{
		log.debug("finding WCarinfo instance with property: " + propertyName
				+ ", value: " + value);
		try
		{
			String queryString = "from WCarinfo as model where model."
					+ propertyName + "= ?";
			Query queryObject = getSession().createQuery(queryString);
			queryObject.setParameter(0, value);
			return queryObject.list();
		} catch (RuntimeException re)
		{
			log.error("find by property name failed", re);
			throw re;
		}
	}

	public List<?> findByWsbh(Object wsbh)
	{
		return findByProperty(WSBH, wsbh);
	}

	public List<?> findByUnitsid(Object unitsid)
	{
		return findByProperty(UNITSID, unitsid);
	}

	public List<?> findByZklx(Object zklx)
	{
		return findByProperty(ZKLX, zklx);
	}

	public List<?> findByZkpzzl(Object zkpzzl)
	{
		return findByProperty(ZKPZZL, zkpzzl);
	}

	public List<?> findByZkdw(Object zkdw)
	{
		return findByProperty(ZKDW, zkdw);
	}

	public List<?> findByHpzl(Object hpzl)
	{
		return findByProperty(HPZL, hpzl);
	}

	public List<?> findByCphm(Object cphm)
	{
		return findByProperty(CPHM, cphm);
	}

	public List<?> findByCllx(Object cllx)
	{
		return findByProperty(CLLX, cllx);
	}

	public List<?> findByZkyx(Object zkyx)
	{
		return findByProperty(ZKYX, zkyx);
	}

	public List<?> findByFdjhm(Object fdjhm)
	{
		return findByProperty(FDJHM, fdjhm);
	}

	public List<?> findByCjh(Object cjh)
	{
		return findByProperty(CJH, cjh);
	}

	public List<?> findByDsrxm(Object dsrxm)
	{
		return findByProperty(DSRXM, dsrxm);
	}

	public List<?> findByDsrsfz(Object dsrsfz)
	{
		return findByProperty(DSRSFZ, dsrsfz);
	}

	public List<?> findByCzxm(Object czxm)
	{
		return findByProperty(CZXM, czxm);
	}

	public List<?> findByCzsfz(Object czsfz)
	{
		return findByProperty(CZSFZ, czsfz);
	}

	public List<?> findByCljg(Object cljg)
	{
		return findByProperty(CLJG, cljg);
	}

	public List<?> findByClyy(Object clyy)
	{
		return findByProperty(CLYY, clyy);
	}

	public List<?> findByCzybh(Object czybh)
	{
		return findByProperty(CZYBH, czybh);
	}

	public List<?> findByJjdw(Object jjdw)
	{
		return findByProperty(JJDW, jjdw);
	}

	public List<?> findByYsr(Object ysr)
	{
		return findByProperty(YSR, ysr);
	}

	public List<?> findByDwjb(Object dwjb)
	{
		return findByProperty(DWJB, dwjb);
	}

	public List<?> findByFxpzh(Object fxpzh)
	{
		return findByProperty(FXPZH, fxpzh);
	}

	public List<?> findByQtdw(Object qtdw)
	{
		return findByProperty(QTDW, qtdw);
	}

	public List<?> findByZkpzh(Object zkpzh)
	{
		return findByProperty(ZKPZH, zkpzh);
	}

	public List<?> findBySfyp(Object sfyp)
	{
		return findByProperty(SFYP, sfyp);
	}

	public List<?> findByNewtzid(Object newtzid)
	{
		return findByProperty(NEWTZID, newtzid);
	}

	public List<?> findByOldtzid(Object oldtzid)
	{
		return findByProperty(OLDTZID, oldtzid);
	}

	public List<?> findBySfyys(Object sfyys)
	{
		return findByProperty(SFYYS, sfyys);
	}

	public List<?> findBySfygc(Object sfygc)
	{
		return findByProperty(SFYGC, sfygc);
	}

	public List<?> findByGchp(Object gchp)
	{
		return findByProperty(GCHP, gchp);
	}

	public List<?> findBySfyhw(Object sfyhw)
	{
		return findByProperty(SFYHW, sfyhw);
	}

	public List<?> findByHwmc(Object hwmc)
	{
		return findByProperty(HWMC, hwmc);
	}

	public List<?> findByIfyj(Object ifyj)
	{
		return findByProperty(IFYJ, ifyj);
	}

	public List<?> findBySm(Object sm)
	{
		return findByProperty(SM, sm);
	}

	public List<?> findByJdczt(Object jdczt)
	{
		return findByProperty(JDCZT, jdczt);
	}

	public List<?> findBySddw(Object sddw)
	{
		return findByProperty(SDDW, sddw);
	}

	public List<?> findBySdyy(Object sdyy)
	{
		return findByProperty(SDYY, sdyy);
	}

	public List<?> findBySdbj(Object sdbj)
	{
		return findByProperty(SDBJ, sdbj);
	}

	public List<?> findByBfbz(Object bfbz)
	{
		return findByProperty(BFBZ, bfbz);
	}

	public List<?> findBySfbdq(Object sfbdq)
	{
		return findByProperty(SFBDQ, sfbdq);
	}

	public List<?> findByZjfs(Object zjfs)
	{
		return findByProperty(ZJFS, zjfs);
	}

	public List<?> findByZjgls(Object zjgls)
	{
		return findByProperty(ZJGLS, zjgls);
	}

	public List<?> findBySfyfdjhcph(Object sfyfdjhcph)
	{
		return findByProperty(SFYFDJHCPH, sfyfdjhcph);
	}

	public List<?> findByCclb(Object cclb)
	{
		return findByProperty(CCLB, cclb);
	}

	public List<?> findByCx(Object cx)
	{
		return findByProperty(CX, cx);
	}

	public List<?> findByPgfl(Object pgfl)
	{
		return findByProperty(PGFL, pgfl);
	}

	public List<?> findByGgnr(Object ggnr)
	{
		return findByProperty(GGNR, ggnr);
	}

	public List<?> findByZcdqcode(Object zcdqcode)
	{
		return findByProperty(ZCDQCODE, zcdqcode);
	}

	public List<?> findByPlzc(Object plzc)
	{
		return findByProperty(PLZC, plzc);
	}

	public List<?> findByBtyzcyy(Object btyzcyy)
	{
		return findByProperty(BTYZCYY, btyzcyy);
	}

	public List<?> findByGgpc(Object ggpc)
	{
		return findByProperty(GGPC, ggpc);
	}

	public List<?> findBySfqzbf(Object sfqzbf)
	{
		return findByProperty(SFQZBF, sfqzbf);
	}

	public List<?> findBySfcx(Object sfcx)
	{
		return findByProperty(SFCX, sfcx);
	}

	public List<?> findByZrcc(Object zrcc)
	{
		return findByProperty(ZRCC, zrcc);
	}

	public List<?> findByZrccmc(Object zrccmc)
	{
		return findByProperty(ZRCCMC, zrccmc);
	}

	public List<?> findByZccc(Object zccc)
	{
		return findByProperty(ZCCC, zccc);
	}

	public List<?> findByZcccmc(Object zcccmc)
	{
		return findByProperty(ZCCCMC, zcccmc);
	}

	public List<?> findByTfwz(Object tfwz)
	{
		return findByProperty(TFWZ, tfwz);
	}

	public List<?> findByClfs(Object clfs)
	{
		return findByProperty(CLFS, clfs);
	}

	public List<?> findByClzt(Object clzt)
	{
		return findByProperty(CLZT, clzt);
	}

	public List<?> findByRcfs(Object rcfs)
	{
		return findByProperty(RCFS, rcfs);
	}

	public List<?> findByZrczy(Object zrczy)
	{
		return findByProperty(ZRCZY, zrczy);
	}

	public List<?> findByZrczyxm(Object zrczyxm)
	{
		return findByProperty(ZRCZYXM, zrczyxm);
	}

	public List<?> findByZcczy(Object zcczy)
	{
		return findByProperty(ZCCZY, zcczy);
	}

	public List<?> findByZcczyxm(Object zcczyxm)
	{
		return findByProperty(ZCCZYXM, zcczyxm);
	}

	public List<?> findByCzyxm(Object czyxm)
	{
		return findByProperty(CZYXM, czyxm);
	}

	public List<?> findByTfcc(Object tfcc)
	{
		return findByProperty(TFCC, tfcc);
	}

	public List<?> findByZdts(Object zdts)
	{
		return findByProperty(ZDTS, zdts);
	}

	public List<?> findByCllb(Object cllb)
	{
		return findByProperty(CLLB, cllb);
	}

	public List<?> findByGgjl(Object ggjl)
	{
		return findByProperty(GGJL, ggjl);
	}

	public List<?> findByClqx(Object clqx)
	{
		return findByProperty(CLQX, clqx);
	}

	public List<?> findBySfws(Object sfws)
	{
		return findByProperty(SFWS, sfws);
	}

	public List<?> findBySfgg(Object sfgg)
	{
		return findByProperty(SFGG, sfgg);
	}

	public List<?> findByWfdm(Object wfdm)
	{
		return findByProperty(WFDM, wfdm);
	}

	public List<?> findByWfnr(Object wfnr)
	{
		return findByProperty(WFNR, wfnr);
	}

	public List<?> findByLrzt(Object lrzt)
	{
		return findByProperty(LRZT, lrzt);
	}

	public List<?> findByJdsbh(Object jdsbh)
	{
		return findByProperty(JDSBH, jdsbh);
	}

	public List<?> findAll()
	{
		log.debug("finding all WCarinfo instances");
		try
		{
			String queryString = "from WCarinfo";
			Query queryObject = getSession().createQuery(queryString);
			return queryObject.list();
		} catch (RuntimeException re)
		{
			log.error("find all failed", re);
			throw re;
		}
	}

	public WCarinfo merge(WCarinfo detachedInstance)
	{
		log.debug("merging WCarinfo instance");
		try
		{
			WCarinfo result = (WCarinfo) getSession().merge(detachedInstance);
			log.debug("merge successful");
			return result;
		} catch (RuntimeException re)
		{
			log.error("merge failed", re);
			throw re;
		}
	}

	public void attachDirty(WCarinfo instance)
	{
		log.debug("attaching dirty WCarinfo instance");
		try
		{
			getSession().saveOrUpdate(instance);
			log.debug("attach successful");
		} catch (RuntimeException re)
		{
			log.error("attach failed", re);
			throw re;
		}
	}

	public void attachClean(WCarinfo instance)
	{
		log.debug("attaching clean WCarinfo instance");
		try
		{
			getSession().lock(instance, LockMode.NONE);
			log.debug("attach successful");
		} catch (RuntimeException re)
		{
			log.error("attach failed", re);
			throw re;
		}
	}
	// -----------------------卖萌的分割线-----------------------------
	
	
	public static int doAddEmptyItem ()
	{
		WCarinfo carinfo = new WCarinfo();
		WCarinfoDAO carinfoDAO = new WCarinfoDAO();
		Transaction tr = HibernateSessionFactory.getSession()
				.beginTransaction();
		tr.begin();
		carinfoDAO.save(carinfo);
		tr.commit();
		System.out.println(carinfo.getTzid());
		return carinfo.getTzid();
	}
	
	public static WCarinfo queryCarinfoByTzid (int tzid)
	{
		WCarinfo carinfo = new WCarinfo();
		
		return carinfo;
	}
	
	// -----------------------卖萌的分割线----------------------------- \\\\
	
	
}